import { reqUserAddress, reqOrderInfo } from "@/axios/api/api.js"
export default {
  namespaced: true,
  state: {
    UserAddress: [],
    OrderInfo: {}
  },
  mutations: {
    GETUSERADDRESS(state, res) {
      state.UserAddress = res
    },
    GETORDERINFO(state, res) {
      state.OrderInfo = res
    }
  },
  actions: {
    // 获取用户收货人信息(需要带token,就是需要登录的情况下)
    async getUserAddress({ commit }) {
      let res = await reqUserAddress()
      commit('GETUSERADDRESS', res.data)
    },
    // 获取订单商品信息
    async getOrderInfo({ commit }) {
      let res = await reqOrderInfo()
      commit('GETORDERINFO', res.data)
    }
  },
  getters: {}
}